<script setup>
import { ref } from 'vue'
//导入接口函数
import { userInfoGetService } from '@/api/user.js'
//导入pinia
import { useUserInfoStore } from '@/stores/user.js'
const userInfoStore = useUserInfoStore();
import { useRouter } from 'vue-router'
const router = useRouter();

const userInfo=ref({
    userId:'',
    name:'',
    sex:'隐私',
    phone:'',
    identity:'',
    loginTime:'',

})
const getUserInf = async () => {
    let result = await userInfoGetService();
    userInfo.value=result.data
    if(userInfo.value.sex===null){
        userInfo.value.sex='男'
    }
}
getUserInf()
const cancel=()=>{
    router.push({path:"/announcement/getLatestNotice"})
}

</script>
<template>
    <el-card class="page-container">
        <template #header>
            <div class="header">
                <span>基本资料</span>
            </div>
        </template>
        <el-row>
            <el-col :span="12">
                <el-form :model="userInfo"  label-width="100px" size="large">
                    <el-form-item label="用户姓名">
                        <el-input v-model="userInfo.name" disabled></el-input>
                    </el-form-item>
                    <el-form-item label="用户账号" >
                        <el-input v-model="userInfo.userId"></el-input>
                    </el-form-item>
                    <el-form-item label="用户性别" >
                        <el-input v-model="userInfo.sex"></el-input>
                    </el-form-item>
                    <el-form-item label="用户身份">
                        <el-input v-model="userInfo.identity"></el-input>
                    </el-form-item>
                    <el-form-item label="用户手机号">
                        <el-input v-model="userInfo.phone"></el-input>
                    </el-form-item>
                    <el-form-item label="登录时间">
                        <el-input v-model="userInfo.loginTime"></el-input>
                    </el-form-item>
                </el-form>
                <el-button @click="cancel">返回</el-button>
            </el-col>
        </el-row>
    </el-card>
</template>